import time
with open ("m1_sorted.txt") as f:
    a = f.readlines()
for i in range(len(a)):
    a[i]=int(a[i])
with open ("m2_reverse.txt") as f:
    b = f.readlines()
for i in range(len(b)):
    b[i]=int(b[i])
with open ("m3_shuffle.txt") as f:
    c = f.readlines()
for i in range(len(b)):
    b[i]=int(b[i])
def bubble_sort(a):
    s = True
    while s:
        s = False
        for i in range(len(a) - 1):
            if a[i] > a[i +1]:
                a[i], a[i +1] = a[i +1], a[i]
                s = True
    return a
t_start = time.time()
bubble_sort(a)
t_finish = time.time()
print("m1_sorted",round((t_finish-t_start)*1000),"milliseconds")
e = time.time()
bubble_sort(b)
r = time.time()
print("m2_reverse",round((r-e)*1000),"milliseconds")
t = time.time()
bubble_sort(c)
y = time.time()
print("m3_shuffle",round((y-t)*1000),"milliseconds")
